#pragma once

#define	PLIC_DISABLE_THRESHOLD		0x7
#define	PLIC_ENABLE_THRESHOLD		0

struct plic_handler
{
    void *base;
    void *hart_base;
    void *enable_base;
    void *priv;
};

void plic_set_priority(struct plic_handler *handler, int irq, int priority);
void plic_irq_enable(struct plic_handler *handler, int irq);
void plic_irq_disable(struct plic_handler *handler, int irq);
void plic_set_threshold(struct plic_handler *handler, int mthreshold);
int  plic_claim(struct plic_handler *handler);
void plic_complete(struct plic_handler *handler, int irq);
void plic_handler_init(struct plic_handler *handler, void *base, unsigned int context_id);
